project( NEWSSUMMARY )
cmake_minimum_required( VERSION 2.6 )
set( LOCATION_DIR   /opt/local )
set( CMAKE_CXX_FLAGS -lpthread)
set( CMAKE_MODULE_PATH modules )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY libs )
set( CMAKE_INSTALL_PREFIX  ${LOCATION_DIR} )
add_definitions( -O2 -Wall -g -DUSE_NET_BYTE )

aux_source_directory( . NEWSSUMMARY )
add_executable( ice_server ${NEWSSUMMARY} )

find_package( libicethread  REQUIRED )
find_package( libicenetwork REQUIRED )
find_package( libgflags     REQUIRED )

mark_as_advanced( 
    ICETHREAD_LIB_INC
    ICETHREAD_LIB_DIR
    ICENETWORK_LIB_INC
    ICENETWORK_LIB_DIR
    GFLAGS_LIB_INC
    GFLAGS_LIB_DIR
    )

IF ( ICETHREAD_LIB_DIR AND ICETHREAD_INC_DIR )
    message( STATUS "ice thread.............." )
    target_link_libraries( ice_server ${ICETHREAD_LIB_DIR} )
    include_directories( ${ICETHREAD_INC_DIR} )
ENDIF ( ICETHREAD_LIB_DIR AND ICETHREAD_INC_DIR )

IF ( ICENETWORK_LIB_DIR AND ICENETWORK_INC_DIR )
    message( STATUS "ice network.............." )
    target_link_libraries( ice_server ${ICENETWORK_LIB_DIR} )
    #include_directories( ${ICETHREAD_LIB_INC} )
ENDIF ( ICENETWORK_LIB_DIR AND ICENETWORK_INC_DIR )

IF ( GFLAGS_LIB_DIR AND GFLAGS_INC_DIR )
    message( STATUS "gflags.............." )
    target_link_libraries( ice_server ${GFLAGS_LIB_DIR} )
    #include_directories( ${ICETHREAD_LIB_INC} )
ENDIF ( GFLAGS_LIB_DIR AND GFLAGS_INC_DIR )

